{extend name="Public:base"/}

{block name="main"}
<div class="box-info">
    <div class="table-tabs">
        <div class="row">
            <div class="col-md-12">
                <ul class="nav nav-tabs" role="tablist">
                    <li class="nav-item">
                        <a class="nav-link {if condition="$groupId==1"}active{/if}" href="{:U('Config/index','groupid=1')}">站点信息</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {if condition="$groupId==2"}active{/if}" href="{:U('Config/index','groupid=2')}">公司信息</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {if condition="$groupId==3"}active{/if}" href="{:U('Config/index','groupid=3')}">Wap设置</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <form class="myform" method="post" action="{:U('Config/save')}">
                {volist name="config" id="vo"}
                {if condition="$vo['type']==1"}
                <div class="form-group row">
                    <label class="form-control-label col-md-2 text-right">{$vo.info}:</label>
                    <div class="col-md-10">
                        <input type="hidden" id="{$vo.varname}" name="{$vo.varname}"  value="{$vo['value']}" size="40" />
                        <div class="card w-100px">
                            <div id="image_aid_box"></div>
                            <a class="thumbnail" href="javascript:swfupload('{$vo.varname}','{:get_auth(1,'1048576',1)}',yesdo)">
                                <img class="card-img" src="{if condition="!empty($vo['value'])"}{$vo['value']}{else/}__IMG__/upload_thumb.png{/if}" id="{$vo.varname}_pic" >
                            </a>
                            <input type="button" value="取消图片" onclick="javascript:clean_thumb('{$vo.varname}');" class="btn btn-sm btn-info" style="margin:0;" />
                        </div>
                        <label>(请根据前端实际图片大小进行设计后上传)</label>
                    </div>
                </div>
                {else/}
                <div class="form-group row">
                    <label class="form-control-label col-md-2 text-right">{$vo.info}:</label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" name="{$vo.varname}" value="{$vo.value}">
                    </div>
                </div>
                {/if}
                {/volist}

                <div class="form-actions">
                    <input type="submit" value="保存" class="btn btn-primary" />
                    <input type="reset" value="重置" class="btn btn-primary"/>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
$(document).ready(function(){
    $('.myform').ajaxForm({
        success:  complete,  // post-submit callback
        dataType: 'json'
    });
});

function complete(data){
    if(data.status==1){
        layer.msg('修改成功');
    }else{
        layer.msg(data.info);
    }
}
</script>
{/block}